/** @file  file
 *  @brief chech it is a number
 * 
 *  program to check wheather the given input is a number or not 
 *   
 *  @author Karthik M 
 *  @bug No  bugs.
 */


#include "header.h"

int valid_no(char *line)
{	                                      	//! procdure to validate number 
   int count  ;
   int flag = 0;
   char  *ptr, *q = NULL;

   count = 0;
   for (ptr = line ;*ptr== ' '|| *ptr =='\t'  ;ptr++ )
      ;
   if (*ptr == '+' || *ptr == '-')
      q=ptr++;										//! check for the sign 

   q = ptr;

   while (*ptr)
   {
      if ( *ptr >= '0' && *ptr <= '9')				//! check is a digit 
         count++;
      else 
         flag = 1;
      ptr++;
   }

//   printf (" flag = %d \n",flag);
   if ( count <= 10 && flag ==0)
   {	                        				 //! verify beyond the range ot not 
      if (is_int(q) == 1)
         return 1;
      else
         return 0;
   }
   else 
      return 0;

}


